﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Mobile.Controllers
{
    /// <summary>
    /// The HomeController determines the origin from the request
    /// and redirects to the mobile area if the request came from 
    /// a mobile device.
    /// </summary>
    public class HomeController : Controller
    {
        /// <summary>
        /// Called when the Index action is requested using GET.
        /// </summary>
        /// <returns>The view or a redirect.</returns>
        public ActionResult Index()
        {
            if (Request.Browser.IsMobileDevice)
            {
                return Redirect("~/Mobile/");
            }

            ViewBag.Message = "Lorem ipsum";

            return View();
        }

        /// <summary>
        /// Called when the about action is requested using GET.
        /// </summary>
        /// <returns>The view.</returns>
        public ActionResult About()
        {
            return View();
        }
    }
}
